package com.net.shop.car.manager.api.volley;

import org.json.JSONException;
import org.json.JSONObject;

import com.net.shop.car.manager.utils.LogUtils;

/**
 * 请求基类
 * 
 * @author wangpeng
 * @date 2014-12-15
 */
public abstract class Request {
	/** 请求类型*/
	private String type;
	
	/**
	 * @param type String
	 */
	public Request(String type) {
		this.type = type;
	}
	
	public String getType() {
		return type;
	}
	
	/**
	 * @return JSONObject
	 */
	public JSONObject toJSON() {
		JSONObject jsonObject = new JSONObject();
		try {
			jsonObject.put("type", type);
			extensionJSON(jsonObject);
		} catch (JSONException e) {
			LogUtils.e(e.getMessage());
		}
		return jsonObject;
	}
	
	/**
	 * @param jsonObject JSONObject
	 */
	public abstract void extensionJSON(JSONObject jsonObject);
}